package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/09 21:41
 **/
public class Day24_2_Num26_RemoveDuplicates {
    class Solution {
        public int removeDuplicates(int[] nums) {
            if(nums.length <= 1) return nums.length;
            int j = 0;
            for(int i = 1;i < nums.length;i++){
                if(nums[i] != nums[j]) nums[++j] = nums[i];
            }
            return j + 1;
        }
    }
}